import citys from '../xuanzechengshi/citys';

Page({
  data: {
    items: [],
  },
  onLoad() {
    const items = citys.map(city => {
      return { label: city.letter, cities: city.list };
      
    });
    this.setData({ items });
    const that = this;
    my.getLocation({
      type: 1, // Using type 1 to get city information
      success(res) {
        that.setData({
          city: res.city
        });
        my.alert({
          title: '你所在的城市是 ' + res.city
        });
      },
      fail() {
        my.alert({
          title: '获取定位失败'
        });
      }
    });
  },
  handleRef(ref) {
    this.form.addItem(ref);
},
gomap(){
  my.navigateTo({
    url: '/pages/map/map',
  })
}
});
